﻿using System.Linq;
using NpCrm.DataAccess.Contracts;
using NpCrm.DataAccess.Core;
using NpCrm.Domain;

namespace NpCrm.DataAccess.Repositories
{
    public class DonationBinRepository : RepositoryBase<DonationBin, int>, IDonationBinRepository
    {
        public IQueryable<DonationBin> GetByDescription(string description)
        {
            return Query(db => db.Description.ToLower().IndexOf(description.ToLower()) > -1);
        }

        public IQueryable<DonationBin> FindForLocation(int addressId)
        {
            return Query(db => db.Location.AddressId == addressId);
        }
    }
}
